All Questions
11 questions
3votes
1answer
3kviews
Java n-ary Tree class with custom made methods and nested Node class
I'm a beginner and I wrote this (working) code for n-ary tree. The specifics: Each node is to be built with an integer value. Each node has a variable number of children. The nodes should have an ...
0votes
1answer
2kviews
Generic Binary Search Tree Implementation in Java
There is an implementation of Binary Search Tree. This is kind of based on Set Theory that duplicates are not allowed but an attempt to adding the same node twice will replace the older node. BSTNode ...
2votes
1answer
346views
Object oriented design for a Tree
I am implementing a Tree in Java. It must be easy to add a new type of tree e.g. Binary tree and Tertiary tree. Each node can have at least one value. It must be easy to make a new type of node and ...
1vote
1answer
122views
Walk on tree with different actions on different nodes
I have a tree whose nodes are of type Node. Depending on the type (one of the implementations of Node) nodes differ in the set ...
1vote
1answer
749views
Count number of leaves in binary tree
Description: Given a binary tree find the number of leaves. Although the problem is simple and has been solved many times I am more interested in find object oriented ways to solve the algorithmic ...
1vote
1answer
2kviews
RB Tree Left and Right Rotate Functions
I am writing a program to implement the Red-Black Tree data structure in java. Below is the beginning of my implementation, namely the left and right rotate functions. I want to know if these ...
1vote
1answer
973views
Method that remove duplicates from a list of words in Java [closed]
Today, I took a coding challenge with this question: Given a List of Strings, write a method removeDuplicates that removes duplicate words from the List and returns an ArrayList of all the unique ...
6votes
4answers
669views
Count number of nodes in a binary tree the OO way
I am trying to write a simplify the algorithm of finding the number of nodes in a binary tree by using good object oriented design. I have been into good OOP style recently and found it really ...
4votes
2answers
1kviews
Binary search tree in Java with only one class
I have written a BST using one class. Is my code okey or something could be better? ...
10votes
1answer
1kviews
Generic domain independent Monte Carlo Tree Search methods library
I've written this small generic library for the purpose of my Bachelor's thesis. It's fully functional and unit tested and I want to get as many opinions as possible regarding overall code quality (...
3votes
2answers
2kviews
Constructing a binary tree in java
I am constructing a binary tree. Let me know if this is a right way to do it. If not please tell me how to?? I could not find a proper link where constructing a general binary tree has been coded. ...